//数组排序
let arr = [3, 9, 42, 8, 14, 51, 12]
for (let i = 0; i < arr.length - 1; i++) {
    for (let j = 0; j < arr.length - i - 1; j++) {
        if (arr[j] > arr[j + 1]) {
            let t = arr[j]
            arr[j] = arr[j + 1]
            arr[j + 1] = t
        }


    }
}

document.write(arr[i])